package com.iotechn.unimall.admin.myapi.question;

import com.iotechn.unimall.core.annotation.HttpMethod;
import com.iotechn.unimall.core.annotation.HttpOpenApi;
import com.iotechn.unimall.core.annotation.HttpParam;
import com.iotechn.unimall.core.annotation.HttpParamType;
import com.iotechn.unimall.core.annotation.param.NotNull;
import com.iotechn.unimall.core.annotation.param.Range;
import com.iotechn.unimall.core.exception.ServiceException;
import com.iotechn.unimall.mydata.domain.AnswerBean;
import com.iotechn.unimall.mydata.domain.QuestionBean;
import com.iotechn.unimall.mydata.domain.ReplyBean;
import com.iotechn.unimall.data.model.Page;

import javax.xml.bind.annotation.XmlType;
import java.util.List;

@HttpOpenApi(group = "course.question",description = "问答中心")
public interface IQuestionService {

    @HttpMethod(description = "创建问题")
    Boolean create(
            @NotNull @HttpParam(name="uid",type = HttpParamType.COMMON, description = "用户id") Integer uid,
            @NotNull @HttpParam(name="title",type = HttpParamType.COMMON, description = "标题") String title,
            @NotNull @HttpParam(name="context",type = HttpParamType.COMMON, description = "内容") String context,
            @HttpParam(name="rewardpoints",type = HttpParamType.COMMON, description = "悬赏积分") Integer rewardpoints,
            @HttpParam(name="category",type = HttpParamType.COMMON, description = "类别")String category,
            @HttpParam(name="category2",type = HttpParamType.COMMON, description = "类别")String category2
    ) throws ServiceException;


    @HttpMethod(description = "用户显示自己发起过的问题")
    List<QuestionBean> ownQuestionlist(
            @NotNull @HttpParam(name="userId",type = HttpParamType.COMMON, description = "用户id") Integer userId) throws ServiceException;

    @HttpMethod(description = "按类别查询所有问题")
    Page<QuestionBean> list(
            @Range(min = 1) @HttpParam(name = "pageNo", type = HttpParamType.COMMON, description = "当前页码") Integer pageNo,
            @Range(min = 1) @HttpParam(name = "limit", type = HttpParamType.COMMON, description = "页码长度") Integer limit,
            @HttpParam(name = "category" ,type = HttpParamType.COMMON,description = "类别信息") String category
    ) throws ServiceException;

    @HttpMethod(description = "查询所有问题")
    List<QuestionBean> listAll(
            @Range(min = 1) @HttpParam(name = "pageNo", type = HttpParamType.COMMON, description = "当前页码") Integer pageNo,
            @Range(min = 1) @HttpParam(name = "limit", type = HttpParamType.COMMON, description = "页码长度") Integer limit
    ) throws ServiceException;

    @HttpMethod(description = "设置问题的最佳回答并加5积分")
    Boolean setBestAnswer(
            @NotNull@HttpParam(name="questionId",type = HttpParamType.COMMON, description = "给哪个问题设置") Integer questionId,
            @NotNull@HttpParam(name="answerId",type = HttpParamType.COMMON, description = "给哪个回答设置")Integer answerId) throws ServiceException;

    /*
    如果曾经点过红心 那么会再次调用方法会减少红心
    如果没有点过 红心是加
     */
    @HttpMethod(description = "关注这个问题的红心数设置")
    Boolean setLoveNumber(
            @NotNull@HttpParam(name="questionId",type = HttpParamType.COMMON, description = "给哪个问题设置") Integer questionId,
            @NotNull @HttpParam(name="userId",type = HttpParamType.COMMON, description = "哪个用户的爱心") Integer userId) throws ServiceException;

    @HttpMethod(description = "关注的问题list")
    List<QuestionBean> followQuestionList(
            @NotNull @HttpParam(name="userId",type = HttpParamType.COMMON, description = "哪个用户的爱心") Integer userId) throws ServiceException;

    @HttpMethod(description = "创建回答并加1积分")
    Boolean createAnswer(
            @NotNull @HttpParam(name="uid",type = HttpParamType.COMMON, description = "用户id") Integer uid,
            @NotNull @HttpParam(name="questionid",type = HttpParamType.COMMON, description = "回答的问题的id") Integer questionid,
            @NotNull @HttpParam(name="context",type = HttpParamType.COMMON, description = "内容") String context
    ) throws ServiceException;

    @HttpMethod(description = "回答列表")
    List<AnswerBean> answerList(
            @NotNull@HttpParam(name="questionId",type = HttpParamType.COMMON, description = "查询哪个问题的回答列表") Integer questionId) throws ServiceException;


    @HttpMethod(description = "我的回答")
    List<AnswerBean> myAnswerList(
            @NotNull@HttpParam(name="userId",type = HttpParamType.COMMON, description = "查询哪个问题的回答列表") Integer userId) throws ServiceException;

    @HttpMethod(description = "点赞")
    Boolean setLikes(
            @NotNull@HttpParam(name="answerId",type = HttpParamType.COMMON, description = "给哪个回答设置")Integer answerId) throws ServiceException;

    @HttpMethod(description = "创建回复回答")
    Boolean createReply(
            @NotNull @HttpParam(name="uid",type = HttpParamType.COMMON, description = "用户id") Integer uid,
            @NotNull @HttpParam(name="answerid",type = HttpParamType.COMMON, description = "回复id") Integer answerid,
            @NotNull @HttpParam(name="context",type = HttpParamType.COMMON, description = "内容") String context
    ) throws ServiceException;

    @HttpMethod(description = "返回所有类别")
    List<String> getCategory(
            @NotNull@HttpParam(name="questionId",type = HttpParamType.COMMON, description = "根据问题id查出所有类别") Integer questionId
    ) throws ServiceException;

    @HttpMethod(description = "根据问题id返回详细问题信息")
    QuestionBean getQuestion(
            @NotNull@HttpParam(name="questionId",type = HttpParamType.COMMON, description = "问题id") Integer questionId
    ) throws ServiceException;

    @HttpMethod(description = "根据评论id返回详细回复信息")
    List<ReplyBean> getReply(
            @NotNull@HttpParam(name="answerid",type = HttpParamType.COMMON, description = "问题id") Integer answerid
    ) throws ServiceException;
}
